SPC Function ---------------------------------------------------------------------------- Action Skips a specified number of spaces in a PRINT, LPRINT, OR PRINT # statement, starting at the current print position. Syntax SPC( n%) Remarks SPC can only be used with PRINT, LPRINT, or PRINT # statements. The argument n% is a number between 0 and 32,767, inclusive, that is combined with the width of the output line to determine the number of blank characters to print. A semicolon (;) is assumed to follow the SPC function. For example, the following two print statements are equivalent. PRINT SPC(10) FixLen1$; SPC(10) FixLen2$; SPC(10) FixLen3$ PRINT SPC(10); FixLen1$; SPC(10); FixLen2$; SPC(10); FixLen3$ Note that the SPC function does more than move the text cursor to a new print position. For screen output it also overwrites any existing characters on a display screen with blanks. The n% blank characters are printed starting at the current print position. The leftmost print position on an output line is always 1; to have any effect, the value of n% must be greater than or equal to 1. The rightmost print position is the current line width of the output device (which can be set with the WIDTH statement). The behavior of an SPC function depends on the relationship between three values. n%, the output-line print position when the SPC function is executed, and the current output-line width. - If n% is greater than the output-line width, SPC calculates n% MOD width and generates the number of blanks indicated by that calculation, starting at the current print position. - If the difference between the current print position and the output-line width is less than n% (or n% MOD width), the SPC function skips to the beginning of the next line and generates a number of blanks equal to n% - (width - current print position). See Also SPACE$, TAB Example The following example demonstrates the use of the SPC statement to insert a number of spaces within a printed line using either the PRINT statement or the LPRINT statement. CLS ' Clear the screen. PRINT "The following line is printed using standard screen print" PRINT "zones." PRINT . PRINT "Column 1","Column 2","Column 3","Column 4","Column 5" PRINT . PRINT PRINT "The next line is printed using the SPC(n%) statement to achieve" PRINT "the same results." PRINT PRINT "Column 1"; SPC(6); "Column 2"; SPC(6); "Column 3"; PRINT SPC(6); "Column 4"; SPC(6); "Column 5" Output The following line is printed using standard screen print zones. Column 1 Column 2 Column 3 Column 4 Column 5 The next line is printed using the SPC(n%) statement to achieve the same results. Column 1 Column 2 Column 3 Column 4 Column 5